<template>
	<section class="scholl">
		<div class="border-box">			
			<ul class="border-b20">
				<router-link tag="li" to="/member/news/message" class="pb30rem pl30rem pr30rem pt30rem layout flex-start">
					<img class="news-system-img" src="../../../assets/member/information_icon.png" >
					<div class="new-info">
						<div class="layout mb5rem">
							<h2 class="fs30rem bold mb5rem">系统消息</h2>
							<!-- <span class="fs24rem c666">2018.2.26</span> -->
						</div>										
					<!-- 	<p class="fs26rem c666">我唱的不是很好听，所以你以为sha吗？</p> -->
					</div>					
				</router-link>
			</ul>	
			<ul class="pl30rem pr30rem"> 
				<router-link tag="li" :to="'/jim?nickname=' + item.username"  class="pb30rem pt30rem layout flex-start border-b" v-for="(item,index) in data" :key="index">
					<img class="news-system-img" src="../../../assets/logo-img.png">
					<div class="new-info">
						<div class="layout mb5rem">
							<h2 class="fs30rem bold mb5rem">{{ item.nickName }}</h2>
							<span class="fs24rem c666">{{ item.mtime,'yyyy-MM-dd hh:mm'  | formatDate }}</span>
						</div>										
						<p class="fs26rem c666"></p>
					</div>					
				</router-link>
			</ul>
		</div>			
	</section>
</template>

<script>
import { formatDate } from "@/utils";
import md5 from 'js-md5';
export default{
	data()
	{
		return{
			data          : [],
			serviceName   : '',
			serviceImg    : '',
			serviceAppkey : ''
		}
	},
	filters: {
		formatDate(time,fmt){
			let date = new Date(time);
			return formatDate(date,fmt);
		}
  	},
	mounted()
	{

	},
	created()
	{
		JIM.getConversation().onSuccess(res=>{
			console.log(res);
			this.data = res.conversations;
		})
			// 离线消息
		JIM.onSyncConversation( res => { //离线消息同步监听
       //      this.msgs.push({
       //      	content:res.msgs[0].content.msg_body.text,
		        // self: false,
		        // avatarUrl: this.avatarUrl
       //      })
        });
		// 已读
        JIM.onMsgReceiptChange(res => {
        	console.log(res)
		});
        JIM.onSyncMsgReceipt(res => {
		    // this.unread_count = res
		});
		// 未读
		JIM.onMutiUnreadMsgUpdate(res => {
			console.log(res)
		});
	},
	methods:
	{
		getService()
		{
			// 获取用户信息
			JIM.getUserInfo({
		        'username' : this.$route.query.nickname,
	        }).onSuccess(res => {
	        	this.serviceName = res.user_info.nickname;
	        	this.serviceImg = res.user_info.avatar;
	        	this.serviceAppkey = res.user_info.appkey;
	        }).onFail(res => {
	            //res.code 返回码
	            //res.message 描述
	        });
		},
	}
}
	
	
</script>

<style lang="less">
	.border-box{
		box-sizing: border-box;
		.news-system-img{
			width: 90/28rem;
			height: 90/28rem;
			border-radius: 100%;
		}
		.new-info{
			width: 570/28rem;
		}
		
	}
	.border-box * {
		box-sizing: border-box;
	}
	
	
</style>

